
#ifndef SCRIPTTHREAD_H
#define SCRIPTTHREAD_H

#include <BScript>
#include <BThread>

using namespace BWE;

struct RunInfo
{
	int		counter;
	int		stackSize;
	int		stackCapacity;
};

class ScriptThread : public BThread
{
public:
	ScriptThread(BScript* script = 0);
	~ScriptThread();

	bool setScript(BScript* script);
	BScript* script();

	void setup(const BString& funcName, const BValueArray& params);

protected:
	void slotScriptPerformed(BObject* object, const BValue& value);

protected:
	virtual int run();

protected:
	BHolder<BScript>	_script;
	BString				_funcName;
	BValueArray			_params;
	BReal				_tick;
	RunInfo				_runInfo;
};

#endif
